/*
6. Write a program that reads the coefficients a, b and c of a quadratic equation ax2+bx+c=0 and solves it (prints its real roots).
*/
using System;

class quadraticEquation
    {
        static void Main()
        {
            double coefficientA;
 
            do {
                Console.Write("Enter coefficient a , not equal to zero: ");
                coefficientA = double.Parse(Console.ReadLine());
            } while (coefficientA == 0);

            Console.Write("Enter coefficient b: ");
            double coefficientB = double.Parse(Console.ReadLine());

            Console.Write("Enter coefficient c: ");
            double coefficientC = double.Parse(Console.ReadLine());

            double firstPart = coefficientB * coefficientB - 4.0 * (coefficientA * coefficientC);
            double secondPart =  Math.Sqrt(firstPart);
            if (firstPart < 0) Console.WriteLine("The quadratic equation ax^2+bx+c is no real roots");
            else if (firstPart == 0) Console.WriteLine("The roots of the quadratic equation ax^2+bx+c are x1=x2={0}",(-coefficientB) / (2.0 * coefficientA));
            else Console.WriteLine("The roots of the quadratic equation ax^2+bx+c are x1={0} and x2={1}",(-coefficientB + secondPart) / (2.0 * coefficientA),(-coefficientB - secondPart) / (2.0 * coefficientA));
        }
    }